﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ArgusLib.FFmpeg.avutil
{
	public class AVAudioFrame : AVFrame
	{
		#region Constructors
		public static AVAudioFrame CreateInstance(AVSampleFormat sampleFormat, int nb_samples, ulong channel_layout, int align)
		{
			AVAudioFrame RetVal = Interop.Functions.av_audioframe_alloc();
			RetVal.SampleFormat = sampleFormat;
			RetVal.NBSamples = nb_samples;
			RetVal.ChannelLayout = channel_layout;
			Interop.Functions.av_frame_get_buffer(RetVal, align);
			return RetVal;
		}
		#endregion

		#region Properties
		public AVSampleFormat SampleFormat
		{
			get { return (AVSampleFormat)this.Structure.format; }
			private set { this.Structure.format = (int)value; }
		}

		public int NBSamples
		{
			get { return this.Structure.nb_samples; }
			private set { this.Structure.nb_samples = value; }
		}

		public ulong ChannelLayout
		{
			get { return this.Structure.channel_layout; }
			private set { this.Structure.channel_layout = value; }
		}
		#endregion
	}
}
